Skip to content

Fix duplicate names for clashing top-level constants - #21

Merged
nikolaushuber merged 5 commits into
mainfrom
fix-rename-issue
Nov 6, 2026
Merged

nikolaushuber merged 5 commits into
mainfrom
fix-rename-issue

Conversation

@nikolaushuber

Copy link
Copy Markdown
Collaborator

namify_common tracked used names in a Name.context. Name.declare strips trailing underscores, so after declaring insert_ the context still reported insert_ as free, and two constants could get the same Python name. The later def then silently shadowed the earlier one. This got much worse with 6162de2, but already happened for names that clash with reserved words or module names (e.g. sum_, iter_, Interval_).

  • Track the exact names used in a Symtab.set; drop the unused class/object namespaces.
  • Add Quick_Test_Name_Clash as a regression test.
  • Add test/test_unique_names.py (make test-names, part of test-all): fails if any generated module binds a name twice. Before this fix it found 41 duplicates, e.g. in Records, Enum and List.

Quick, oracle, slow and names tests pass.

Fixes #20

@nikolaushuber
nikolaushuber merged commit 4e31672 into main Nov 6, 2026
4 checks passed
@nikolaushuber
nikolaushuber deleted the fix-rename-issue branch November 6, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate Python names for constants with the same base name (single-module export)

1 participant